/***********************************************************************
    filename:   DaterEvent.h
    created:    10/4/2012
    author:     4Ys

    purpose:    Defines abstract base class for Event objects
*************************************************************************/
#ifndef _DaterEvent_h_
#define _DaterEvent_h_

#include "DaterTime.h"
#include "DaterReminding.h"
#include "DaterRepeating.h"

#include <string>

namespace Dater
{
	/*!
	\brief
		The core class of Dater, most usercases involve.
	*/
	class Event
	{
	public:
		/* !
		\brief
			Construct the sample of class Event

		\param name
			- a string to represent the event

		\param startTime
			- a int* to show the start time and date of the event

		\param finishTime
			- a int * to show the finish time and date of the event

		\param description
			- descripe the details of the event

		\param userID
			- show the owner of a certain event
			
		\param eventID
			- show the key of a certain event to indentify 
		*/
		Event(const std::string& type, const std::string& name, const Time& startTime, const Time& finishTime, 
			const std::string& description, unsigned int userID, unsigned int eventID);

		/*!
			Destructor of class Event
		*/
		virtual ~Event();

		/* !
		\brief
			Set the name of a certain event

		\param name
			- a string to represent the event

		\return
			Nothing
		*/
		void setName(const std::string& name);
		
		/* !
		\brief
			Set the start time of a certain event

		\param startTime
			- a int* to show the start time and date of the event

		\return
			Nothing
		*/
		void setStartTime(const Time& startTime);

		/* !
		\brief
			Set the finish time of a certain event

		\param finishTime
			- a int * to show the finish time and date of the event

		\return
			Nothing
		*/
		void setFinishTime(const Time& finishTime);
		

		void setCreateTime(const Time& createTime);
		/* !
		\brief
			Set the description of a certain event

		\param description
			- descripe the details of the event

		\return
			Nothing
		*/
		void setDescription(const std::string& description);
		
		/* !
		\brief
			Set the setting of reminding of the event

		\param remindTime
			The time of reminding.

		\param remindUnit
			The unit of reminding.

		\return
			Nothing
		*/
		void setReminding(int remindTime, std::string remindUnit);

		void setRepeating(int repeatInterval, std::string repeatUnit, Time repeatEndTime);

		void setAllDay(bool setting);

		/* !
		\brief
			get the type of a certain event

		\return
			the type of a certain event
		*/
		const std::string& getType();
		
		/* !
		\brief
			get the name of a certain event

		\return
			the name of a certain event
		*/
		std::string& getName();
				
		/* !
		\brief
			get the start time of a certain event

		\return
			the start time of a certain event
		*/
		Time& getStartTime();
					
		/* !
		\brief
			get the finish time of a certain event

		\return
			the start finish of a certain event
		*/
		Time& getFinishTime();
				
		/* !
		\brief
			get the create time of a certain event

		\return
			the create time of a certain event
		*/
		Time& getCreateTime();
				
		/* !
		\brief
			get the description of a certain event

		\return
			the description of a certain event
		*/
		std::string& getDescription();
				
		/* !
		\brief
			get the reminding of a certain event

		\return
			the reminding of a certain event
		*/
		Reminding* getReminding();

		Repeating* getRepeating();

		const std::string& getTagColor();
				
		/* !
		\brief
			get the event ID of a certain event

		\return
			the event ID of a certain event
		*/
		unsigned int getEventID();

		/* !
		\brief
			get the user ID of a certain event

		\return
			the user ID of a certain event
		*/
		unsigned int getUserID();

		bool isAllDay();

		bool isAllDayOfOneDay(int year, int month, int day);

	protected:
		//! A string contains the name of the event.
		std::string _name;

		//! The create time of the event.
		Time _createTime;

		//! The start time of the event.
		Time _startTime;

		//! The finish time of the event.
		Time _finishTime;

		//! A string contains the description of the event.
		std::string _description;

		//! An integer means the uid of the event of a specific user
		unsigned int _eventID;

		//! An integer means the uid of the specific user
		unsigned int _userID;

		//! The reminding of the event.
		Reminding* _reminding;

		Repeating* _repeating;

		bool _allDay;

		//! Type of the Event.
		const std::string _type;

		std::string _tagColor;

	private:
		Event(const Event&) {}
		Event& operator=(const Event&) {return *this;}
	};

}

#endif